package Controller.DepServlet;

import Dao.DepDao;
import bean.Dep;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/dep_change")
public class dep_change extends HttpServlet {
    DepDao depDao = new DepDao();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        String dno = req.getParameter("dno");
        Dep dep  = depDao.selectByDno(dno);
        req.setAttribute("dep", dep);
        req.getRequestDispatcher("DepInfoChange.jsp").forward(req, resp);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
